<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ES6中对象的简化写法</title>
</head>

<body>
  <script>
    /* 
ES6中对象的简化写法:ES6中允许大括号存在，直接写入变量和函数，作为对象的属性和方法
*/
    //1.这样书写很简洁
    let name = "jason";
    let age = 20;
    let show = function () {
      console.log(name + age);
    }
    let obj = {
      name,
      age,
      show,
      //2.函数书写可以更简洁
      improve() {
        console.log("我们可以更简洁");
      }
    }
    console.log(obj);
  </script>
</body>

</html>